<!-- 新建虚拟卡券 -->
<template>
  <a-drawer v-model:visible="vdata.visible" :maskClosable="false" :title="'虚拟卡券'" width="30%">
    <a-form ref="formRef" :model="vdata.saveObject" layout="horizontal" labelAlign="left"
      :hideRequiredMark="true" :colon="false" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }"
      style="margin-top: 30px; margin-left: 20px;">
      <a-form-item name="sTime" label="上架时间" :wrapper-col="{ span: 12 }">
        <a-range-picker
          v-model:value="vdata.saveObject['sTime']"
          value-format="YYYY-MM-DD"
          :disabled-date="(current)=>current && current < dayjs().endOf('day')"
        />
      </a-form-item>
      <a-form-item label="卡券奖品代码" name="awardName" :wrapper-col="{ span: 12 }">
        <a-input v-model:value="vdata.saveObject['actName']" placeholder="卡券奖品代码" />
      </a-form-item>
      <a-form-item label="兑换所需福分" name="needPoint" :wrapper-col="{ span: 12 }">
        <a-input v-model:value="vdata.saveObject['needPoint']" placeholder="卡券奖品代码" />
      </a-form-item>

    </a-form>
    <div class="drawer-btn-center">
      <a-button :style="{ marginRight: '8px' }" style="margin-right:8px" @click="onClose">
        <close-outlined />
        取消
      </a-button>
      <a-button type="primary" :loading="vdata.btnLoading" @click="handleOkFunc">
        <check-outlined />
        保存
      </a-button>
    </div>
  </a-drawer>
</template>

<script setup>
import { reactive, ref, defineExpose, watch } from 'vue'
import dayjs from 'dayjs'


const vdata = reactive({
  visible: false,
  saveObject: {},
})

function handleOkFunc(){
  vdata.btnLoading = true
  console.log(vdata.saveObject)
}

function onClose(){
  vdata.visible = false
}

function show(){
  vdata.btnLoading = false
  vdata.visible = true
}

defineExpose({
  show
})

</script>

<style>
</style>